<template>
  <view  class="lampgrid">
	<u-grid :col="4">
		<u-grid-item @click="searchList(item.id)" v-for="(item,index) in category.fglist.slice(0,4)" :key="item.id">
				<u-avatar :src="item.image_url"></u-avatar>
			<view class="grid-text">{{item.name}}</view>
		</u-grid-item>

	</u-grid>
    </view>
</template>
<script setup>
  import {
    searchStore
  } from "../../store/search.js"
  const searchstore = searchStore()
  const {
    category,

  } = searchstore
 //发送请求获取灯具分类
 searchstore.getcategory()
  function searchList(id){
    uni.navigateTo({
      url:`/subPack/SearchList/SearchList?xuanzfgfl=${id}`
    })
  }
</script>

<style scoped lang="scss">
  .lampgrid{
    background-color: #fff;
    margin-top: 20rpx ;
   padding-top: 20rpx;
  }
   .grid-text {
    	font-size: 28rpx;
    	margin-top: 4rpx;
    	color: #242424;
          padding: 10rpx 0 20rpx 0rpx;
          /* #ifndef APP-PLUS */
          box-sizing: border-box;
          /* #endif */
      }

</style>